import request from '@/utils/request'


export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
export function page(pageNo, pageSize, username, email) {
  return request({
    url: '/user/page',
    method: 'get',
    params: {
      pageNo,
      pageSize,
      username,
      email
    }
  })
}
export function deleteRoleById(id) {
  return request({
    url: `/user/${id}`, // 根据角色ID构造删除角色的URL
    method: 'delete'
  })
}

export function updateuser(user){
  return request({
    url: '/user',
    method: 'put',
    data: user
  });
}


export function adduser(user){
  return request({
    url: '/user',
    method: 'post',
    data: user
  });
}


export function queryById(id){
  return request({
    url:`/user/${id}`,
    method: 'get'

  })
}
